package com.demo.web.modules.uiv;

import com.demo.common.constant.api.base.IDEntity;
import com.demo.common.constant.api.base.IdsItem;
import com.demo.common.result.ResponseInfo;
import com.demo.common.result.ResultVo;
import com.demo.dao.uiv.entity.UivPageInfo;
import com.demo.service.uiv.UivPageInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/uiv/page_info")
public class UivPageInfoController {
    @Autowired
    private UivPageInfoService myService;

    @GetMapping("/test")
    public String test(){
        return "hello, you are in UivPageInfo test!";
    }


    //查询
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public ResultVo getPageInfo(@RequestBody IDEntity<Long> ids){
        return ResponseInfo.<Object>success(myService.getPageInfo(ids.getId()));
    }

    //增加
    @RequestMapping(value = "save", method = RequestMethod.POST)
    public ResultVo insertPageInfo(@RequestBody UivPageInfo info){
        //System.out.print(info);
        return ResponseInfo.<Object>success(myService.savePageInfo(info));
    }

    //删除
    @RequestMapping(value = "remove", method = RequestMethod.POST)
    public ResultVo removePageInfo(@RequestBody IdsItem<Long> pageNode){
        //System.out.println(pageNode);

        return ResponseInfo.<Object>success(myService.removePageInfo(pageNode.getIds()));
    }
}
